﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NCP.Recruiting.Web.Framework.UI.Paging;
using NCP.Infrastructure.Common;

namespace NCP.Recruiting.WebApp.Models
{
    public class PagingFilteringModel : BasePageableModel
    {
    }

    public class PagingFilteringModel<T> : PagingFilteringModel
    {
        public PagingFilteringModel()
        {
        }

        public PagingFilteringModel(IPagedList<T> pagedList) 
        {
            FirstItem = (pagedList.PageIndex * pagedList.PageSize) + 1;
            HasNextPage = pagedList.HasNextPage;
            HasPreviousPage = pagedList.HasPreviousPage;
            LastItem = Math.Min(pagedList.TotalCount, ((pagedList.PageIndex * pagedList.PageSize) + pagedList.PageSize));
            PageNumber = pagedList.PageIndex + 1;
            PageSize = pagedList.PageSize;
            TotalItems = pagedList.TotalCount;
            TotalPages = pagedList.TotalPages;
        }
    }
}